package main

import (
	"fmt"
	"time"
)

func main() {
	go printnum(1)
	time.Sleep(5 * time.Millisecond)
	go printnum(2)
	for i := 1; i <= 1000; i++ {
		fmt.Printf("\t 主goroutine A %d \n", i)
	}
	time.Sleep(3000 * time.Millisecond)
	fmt.Println("执行完毕")
}

func printnum(a int) {
	for i := 0; i < 1000; i++ {
		fmt.Printf("子goroutine %d %d \n ", i, a)
		time.Sleep(20 * time.Millisecond)
	}
}
